package com.alan.server2.server;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;

/**
 * OK
 * Created by Alan on 17-8-22
 */
@Service
public class TestServer {

    RestTemplate restTemplate = new RestTemplate();

    @HystrixCommand(fallbackMethod = "error")
    public String test( String str){
        return restTemplate.getForEntity("http://127.0.0.1:9101/test/test?str={}",String.class,str).getBody();
    }

    String error( String str){
        return "error"+str;
    }

}
